home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / aviplay / aviplay.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  1.6 KB  |  50 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "AVI Play"
  4.    ClientHeight    =   825
  5.    ClientLeft      =   3810
  6.    ClientTop       =   1785
  7.    ClientWidth     =   2175
  8.    Height          =   1230
  9.    Icon            =   AVIPLAY.FRX:0000
  10.    Left            =   3750
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   825
  14.    ScaleWidth      =   2175
  15.    Top             =   1440
  16.    Visible         =   0   'False
  17.    Width           =   2295
  18. Declare Function mciSendString Lib "MMSystem" (ByVal lpstrCommand As String, ByVal lpstrReturn As String, ByVal nSize As Integer, ByVal hCallback As Integer) As Long
  19. Declare Function mciGetErrorString Lib "MMSystem" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal wLength As Integer) As Integer
  20. Sub Form_Load ()
  21.     fname$ = Command$
  22.     If Len(fname$) < 1 Then End
  23.     caption = "Playing"
  24.     i = playit(fname$)
  25.     End
  26. End Sub
  27. Function playit (fname$)
  28. Dim res1 As String
  29. res1 = SendMciCommand$("open " + fname$ + " alias video9 wait")
  30. res1 = SendMciCommand$("play video9 wait")
  31. res1 = SendMciCommand$("close video9")
  32. End Function
  33. Function SendMciCommand$ (cmd As String)
  34.     Dim result As String
  35.     Dim status As Integer
  36.     Dim i As Integer
  37.     result = String$(256, 0)
  38.     caption = "Send It"
  39.     status = mciSendString(cmd, result, Len(result), 0)
  40.     If (status <> 0) Then
  41.         status = mciGetErrorString(status, result, Len(result))
  42.     End If
  43.     i = InStr(result, Chr$(0))
  44.     If i <> 0 Then
  45.         SendMciCommand$ = Left$(result, i - 1)
  46.     Else
  47.         SendMciCommand$ = result
  48.     End If
  49. End Function
  50.